package com.cert;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class Test {

	static Integer aaa = 0;

	public static void main(String[] args) {
		ExecutorService service = Executors.newFixedThreadPool(2);
		service.execute(new Runnable() {
			
			@Override
			public void run() {
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println(Thread.currentThread().getName()+ " hello world");
			}
		});
		service.execute(new Runnable() {
			
			@Override
			public void run() {
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println(Thread.currentThread().getName()+ " hello world");
			}
		});
		service.execute(new Runnable() {
			
			@Override
			public void run() {
				try {
					Thread.sleep(1000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
				System.out.println(Thread.currentThread().getName()+ " hello world");
			}
		});
	}

//	static { // 如果不加上这个if语句，编译器将提示“Initializer does not complete normally” 并拒绝编译
//		if (true) {
//			System.out.println(Thread.currentThread() + "init DeadLoopClass");
//			while (true) {}
//		}
//	}

}
